// const baseUrl = "https://oldermp.tzfcw.top"; //根路径
const baseUrl = "http://localhost:8082" //测试url
const baseContext = ""; // context路径

const request = (url = '', type = 'GET', param = {}, header = {}) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: baseUrl + baseContext + url,
			method: type,
			header: header,
			data: param,
			success: (res) => {
				resolve(res) //将正确的响应结果封装成新的promise对象
			},
			fail: (error) => {
				reject(error) //将不正确的响应结果封装成新的promise对象
			}
		})
	})
}

export {
	request,
	baseContext,
	baseUrl
}